def fun():
    num = int(input("请输入一个十进制的整数:"))
    print(str(num) +"转为2进制数为:",bin(num))
    print('%s转为2进制数为:%s' %(num, bin(num)))
    print('{0}转为2进制数为:{1}'.format(num, bin(num)))
    print(str(num) + "转为8进制数为:", oct(num))
    print(str(num) + "转为16进制数为:", hex(num))

if __name__ == '__main__':
    while True:
        try:
            fun()
            break
        except:
            print('程序出错,请重新输入!!!')


